DEFAULT ENV SETTING

If the ENV partition is suddenly powered off during the reading and writing process, there is a very small probability that data will be damaged, resulting in loss of ENV. Once the data is lost, the system will fail to start. To ensure the normal startup of the system, when the ENV partition data CRC check fails, it will automatically start from the default value. Since the settings of each user partition are different, please follow the following two steps to configure the default value in the corresponding place.

The following log represents ENV CRC check failed:

*** warning - bad CRC, using default environment

Take NAND flash as an example(*NOR flash can skip to the second step)

  1. Set default mtdpart:(Partition information)

    Modify the corresponding macro definition MTDPARTS_DEFAULT in the boot/include/configs/infinity2m.h.

    Note: Keep the mtdpart here consistent with the mtdpart entered under uboot.

    Eg:Enter mtdpart under uboot

    There are multiple MTDPARTS_DEFAULT macro variables in boot/include/configs/infinity2m.h. If you don’t want to distinguish, set MTDPARTS_DEFAULT to the same value.

  2. Set default bootargs and bootcommand in Uboot

    In the current version, there are two macro definitions at the end of the file Uboot/include/configs/infinity2m.h.

    Eg:Input printenv bootargs/printenv bootcmd in uboot

    Fill in the values of bootargs and bootcmd into CONFIG_BOOTARGS/CONFIG_BOOTCOMMAND corresponding to the figure below.

1. Set custom default ENV in Uboot

Modify `boot\include\env_default.h`:

Add the default ENV to the default\_environment[] array (\*The bootargs and bootcmd set above will eventually be defined in this array).

![](media/default env5.png)

![](media/default env6.png)

After setting the default env necessary for system startup in `boot/include/configs/infinity2m.h`, recompile uboot and update it to the board to ensure that the system can start normally when the env data is lost.